import { http } from "@/utils/http";

export type Post = {
  id?: number; // 标记为主列，值自动生成

  title: string;

  author: string;

  content: string;

  thumb_url: string;

  type: number;

  create_time?: Date;

  update_time?: Date;
};
/**
 * 新建文章
 * @param params
 * @returns
 */
export function createPost(params: Post): Promise<any> {
  return http.request({
    url: "/post",
    method: "post",
    data: params
  });
}

/**
 * 获取文章列表
 */
export function getPosts(params?: object): Promise<any> {
  return http.request({
    url: "/post",
    method: "get",
    params
  });
}
